package com.ptswitch.material.pages.emailaddress;

import org.apache.tapestry5.EventConstants;
import org.apache.tapestry5.annotations.InjectPage;
import org.apache.tapestry5.annotations.OnEvent;
import org.apache.tapestry5.ioc.annotations.Inject;

import com.ptswitch.material.pages.base.PageBase;
import com.ptswitch.material.pages.user.ListUser;
import com.ptswitch.material.service.EMailAddressService;
import com.ptswitch.material.util.security.PermissionUtil;

public class DeleteEMailAddress extends PageBase {
    @Inject
    private EMailAddressService emailAddressSer;
    @InjectPage
    private ListUser listUser;

    @OnEvent(value = EventConstants.ACTIVATE)
    Object delete(String id) {
        checkPermitted(PermissionUtil.EmailAddressAll);
        emailAddressSer.delete(id);
        return listUser;
    }
}
